package com.uestc.soft.service;

import com.uestc.soft.mapper.RIMapper;
import com.uestc.soft.pojo.RI;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class RIService {
    @Resource
    private RIMapper RI_Mapper;
    public Map<String, Object> selectByPage(int page, int limit,Timestamp startDate, Timestamp endDate, String proState, String type, String iP_Command) {
        // page 页码   (page-1)*limit=起始下标index
        int index = (page - 1) * limit;   // 计算出起始下标
        List<RI> RIList = RI_Mapper.selectByPage(index, limit, startDate,endDate,proState,type,iP_Command);
        Map<String, Object> map = new HashMap<>();
        map.put("code", 0);
        map.put("msg", "查询成功");
        map.put("count", RI_Mapper.selectCount(startDate,endDate,proState,type,iP_Command));
        map.put("data", RIList);
        return map;
    }
}
